package com.example.handler;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 *   配置拦截器拦截的方法
 */

@Configuration
public class WebMvcConfig   {

    @Resource
    private AccessTokenInterceptor accessTokenInterceptor;

    @Bean
   public WebMvcConfigurer webMvcConfigurer(){
       return new WebMvcConfigurer() {
           public void addInterceptors(InterceptorRegistry registry){
               registry.addInterceptor(accessTokenInterceptor).addPathPatterns("/open/api/*");
           };
       };
   }

}
